<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <body>
        <ui:composition template="/WEB-INF/templates/newMainCandidateTemplate.xhtml">
            <ui:define name="content">
                <h:outputStylesheet library="css" name="candidate/candidate.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_desktop.css" media="screen and (min-width:1025px) and (max-width:1600px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_desktop_wide.css" media="screen and (min-width : 1601px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_tablet.css" media="screen and (min-device-width : 768px) and (max-device-width : 1024px), screen and (max-width:1024px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_smartphone.css" media="screen and (min-device-width : 320px) and (max-device-width : 767px), screen and (max-width:767px)"></h:outputStylesheet>
                
                
                <h:form id="educationalForm">
                    <p:growl id='educationalGrowl'></p:growl>
                    <p:panel id="editEducationalPanel" styleClass="noPaddingTopTitle noMargin  noBorder marginTopBar" header="#{messages.Educational}">
                        <p:panel id="selectorEducationalLevel" styleClass="noPadding marginTop05em">  
                            <p:selectOneMenu required="true" requiredMessage="#{messages.EducationalLevelRequired}" converter="#{educationalLevelConverter}" id="editSelectEducationalLevel"  value="#{newEditCandidateBean.collectorEducationalInfo.educationalLevel}" effect="fade" label="#{messages.EducationalLevel}">  
                                <f:selectItem itemLabel="#{messages.EducationalLevel}" itemValue="" />  
                                <f:selectItems value="#{userResourcesBean.educationalLevels}" var="editEducationalLevel" itemLabel="#{educationalLevelBundle[editEducationalLevel.idEducationalLevel.toString()]}" itemValue="#{editEducationalLevel}"/>  
                                <p:ajax event="change" update=":educationalForm"/>  
                            </p:selectOneMenu>
                        </p:panel>
                        <p:panel id="educationalValuePanel" styleClass="noPadding" rendered="#{newEditCandidateBean.collectorEducationalInfo.educationalLevel.educationalValue>'2'}">  
                            <p:inputText id="editEducationalDescription" styleClass="width100" required="true" value="#{newEditCandidateBean.collectorEducationalInfo.description}" label="#{messages.EducationalDescription}">  
                                <f:validateLength maximum="100"></f:validateLength>
                            </p:inputText>  
                            <p:watermark for="editEducationalDescription" value="#{messages.EducationalDescription}" />
                            <p:selectOneMenu filter="true" filterMatchMode="contains" converter="#{sectorConverter}" id="editSelectSector" required="true" value="#{newEditCandidateBean.collectorEducationalInfo.sector}" effect="fade" label="#{messages.Sector}">  
                               <f:selectItem itemLabel="#{messages.Sector}" itemValue="" />  
                               <f:selectItems value="#{userResourcesBean.sectors}" var="sector" itemLabel="#{sectorBundle[sector.idSector.toString()]}" itemValue="#{sector}"/>  
                            </p:selectOneMenu>
                            <p:selectOneMenu converter="#{educationalStatusConverter}" id="editSelectStatus" required="true" value="#{newEditCandidateBean.collectorEducationalInfo.status}" effect="fade" label="#{messages.EducationalStatus}">  
                               <f:selectItem itemLabel="#{messages.EducationalStatus}" itemValue="" />  
                               <f:selectItems value="#{userResourcesBean.educationalStatuses}" var="editSelectStatus" itemLabel="#{educationalStatusBundle[editSelectStatus.idEducationalStatus.toString()]}" itemValue="#{editSelectStatus}"/>  
                            </p:selectOneMenu>
                        </p:panel>  
                        <p:commandButton rendered="#{newEditCandidateBean.collectorEducationalInfo.idCandidateEducationalInfo==null}" update=":educationalForm" styleClass="grayBackgroundStrong" process="@form" actionListener="#{newEditCandidateBean.saveEducational()}" value="#{messages.Add}"  action="#{newEditCandidateBean.reditectToEducationalPanel()}"></p:commandButton>    
                        <p:commandButton rendered="#{newEditCandidateBean.collectorEducationalInfo.idCandidateEducationalInfo!=null}" update=":educationalForm" styleClass="grayBackgroundStrong" process="@form" actionListener="#{newEditCandidateBean.editEducational()}" value="#{messages.Edit}" action="#{newEditCandidateBean.reditectToEducationalPanel()}"></p:commandButton>    
                        <p:commandButton process="@this"  styleClass="marginBottom05em marginTop05em grayBackgroundStrong block" id="back_button" value="#{messages.Cancel}" action="#{newEditCandidateBean.cancelReditectEducationalPanel()}"></p:commandButton>
                    </p:panel>
                </h:form>                
            </ui:define>
        </ui:composition>
         
    </body>
</html>
